package pub.guoxin.oops.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created by guoxin on 17-11-14.
 */
public class MailUtils {

    private static final Pattern pattern = Pattern.compile("^(\\w)+(\\.\\w+)*@(\\w)+((\\.\\w+)+)$");

    public static boolean validate(String mail) {
        Matcher matcher = pattern.matcher(mail);
        boolean matches = matcher.matches();
        return matches;
    }

    public static void main(String[] args) {
        boolean validate = validate("abc_Wang.dd.ccsian.com");
        System.out.println(validate);
    }
}
